//树状数组-楼兰图腾
//思路: 对于每个位置, 统计左边比自己大的 * 右边比自己大的, 各个位置相加; 统计左边比自己小的 * 右边比自己小的, 各个位置相加
#include <iostream>
#include <cstring>
using namespace std;
#define lowbit(x) (x & -x)
const int N = 200010;
typedef long long ll;
ll a[N];
int n;

ll s[N];
ll up[N], down[N];

void modify(int x, ll k)
{
    for(int i = x; i <= n; i += lowbit(i)) s[i] += k;
}

ll query(int x)
{
    ll sum = 0;
    for(int i = x; i; i -= lowbit(i)) sum += s[i];
    return sum;
}

int main()
{
    cin >> n;
    for(int i = 1; i <= n; i++)
    {
        cin >> a[i]; 
        up[i] = query(n) - query(a[i]); 
        down[i] = query(a[i] - 1);
        modify(a[i], 1);
    }

    ll ret1 = 0, ret2 = 0;
    memset(s, 0, sizeof(s));
    for(int i = n; i >= 1; i--)
    {
        ret1 += up[i] * (query(n) - query(a[i])); 
        ret2 += down[i] * query(a[i] - 1);
        modify(a[i], 1);
    }
    cout << ret1 << " " << ret2 << endl;
    return 0;
}
